package com.xmall.define.dict;

import com.xmall.annotation.Dict;

/**
 * 订单状态
 */
@Dict
public enum OrderStatusEnum {

    WAIT_PAY("待付款", 0), WAIT_CONSIGN("待发货", 1),
    WAIT_RECEIVE("待收货", 2), FINISHED("已完成", 3),
    CANCELED("已取消", 4), REFUNDING("退款中", 5),
    PART_REFUND("部分退款", 6), ALL_REFUND("全部退款", 7);

    private String name;

    private Integer status;

    OrderStatusEnum(String name, Integer status) {
        this.name = name;
        this.status = status;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getStatus() {
        return status;
    }

    public static String getNameByStatus(Integer status) {
        for (OrderStatusEnum value : values()) {
            if(value.getStatus() == status) {
                return value.getName();
            }
        }
        return "";
    }
}
